<?php

function safe_get_env($name) {
	if (isset($_SERVER[$name])) return $_SERVER[$name];
	else if (mb_strpos(php_sapi_name(), 'apache') === false) return getenv($name);
	else return '';
}

$strBaseUrl	   = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://') . safe_get_env('HTTP_HOST');
$strBaseDomain = str_replace('www.', '', safe_get_env('HTTP_HOST'));

$this->base_constants = array(
    "url" => array(
        "root_url" => $strBaseUrl,
        "domain"   => $strBaseDomain,
        "static"   => "http://static." . $strBaseDomain
    ),
    "path" => array(
        "static" => $this->_root_path . "/static",
        "libs"   => $this->_root_path . "/libs",
        "data"   => $this->_root_path . "/data"
    ),
    "theme" => array( "default" => "default", "current" => "default" )
);

$this->extend_constants = array(
     "url" => array(
        "static_default" => $this->base_constants["url"]["static"] . "/" . $this->base_constants["theme"]["default"],
        "static_theme"   => $this->base_constants["url"]["static"] . "/" . $this->base_constants["theme"]["current"],
     )
);

$this->_extend_variables = array(
    "url" => array(
        "default_css" => array(
            $this->extend_constants["url"]["static_default"] . "/css/reset.css",
            $this->extend_constants["url"]["static_default"] . "/css/grid.css",
            $this->extend_constants["url"]["static_theme"] . "/css/theme.css"
        ),
        "default_js" => array(
            "https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"
        )
    )
);

?>